<?php
declare (strict_types=1);

namespace app\common\facade;

/**
 * @method static \app\common\tool\Swoole\Client\TCP TCP()
 */
class Client
{


    /**
     * @param string $name
     * @param array $arguments
     *
     * @return mixed
     */
    public static function __callStatic($name, $arguments)
    {
        return (new static())->__call($name, $arguments);
    }

    /**
     * @param string $driver
     * @param array $arguments
     *
     * @return mixed
     */
    public function __call($driver, $arguments)
    {
        $driver = \ucfirst($driver);

        $class = "\app\\common\\tool\\Swoole\\Client\\{$driver}";
        if (\class_exists($class)) {
            return new $class();
        }
        throw new \Exception("class {$driver} not find ");
    }


}